import java.util.Random;

enum Note{
    MiDDLE_C, C_SHARP, B_FLAT;
}
class Instrument{
    void play(Note note){
        System.out.println("Instrument note "+ note);
    }
    String what (){
        return "Instrument";
    }
    void adjust(){
        System.out.println("Instrument adjust");
    }
}
class Wind extends Instrument{
    @Override
    void play(Note note) {
        System.out.println("Wind note "+ note);
    }

    @Override
    String what() {
        return "Wind";
    }

    @Override
    void adjust() {
        System.out.println("Wind adjust");
    }
}
class Stringed extends Instrument{
    @Override
    void play(Note note) {
        System.out.println("Stringed note "+ note);
    }

    @Override
    String what() {
        return "Stringed";
    }

    @Override
    void adjust() {
        System.out.println("Stringed adjust");
    }
}
class Woodwind extends Wind{
    @Override
    void play(Note note) {
        System.out.println("Woodwind note " + note);
    }

    @Override
    void adjust() {
        System.out.println("Woodwind adjust");
    }
}
class RandomInstrument{
    private final Random rand = new Random(47);
    public Instrument tune(){
        switch (rand.nextInt(3)){
            default:
            case 0: return new Wind();
            case 1: return new Stringed();
            case 2: return new Woodwind();
        }
    }
}
public class Test3 {
    public static void tuneAll(Instrument[] instruments){
        for (Instrument i: instruments) {
            i.adjust();
        }
    }
    private static RandomInstrument ins = new RandomInstrument();
    public static void main(String[] args) {
        Instrument[] instruments = new Instrument[5];
        for (int i = 0; i < instruments.length; i++) {
            instruments[i] = ins.tune();
        }
        for (Instrument i: instruments) {
            i.play(Note.MiDDLE_C);
        }
        instruments = new Instrument[]{
                new Wind(),
                new Woodwind(),
                new Stringed(),
                new Woodwind(),
                new Wind(),
        };
        tuneAll(instruments);
    }
}
